package hbt;

import modelo.SolicitudOrdenCompra;

import org.hibernate.Session;
import org.hibernate.SessionFactory;


public class SolicitudOrdenCompraDAO {

		private static SolicitudOrdenCompraDAO instancia = null;
		private static SessionFactory sf = null;

		public static SolicitudOrdenCompraDAO getInstancia(){
			if(instancia == null){
				sf = HibernateUtil.getSessionFactory();
				instancia = new SolicitudOrdenCompraDAO();
			} 
			return instancia;
		}
		
		public void grabarSolicitudOrdenCompra (SolicitudOrdenCompra soc){
			Session session = sf.openSession();
			session.beginTransaction();
			session.persist(soc);
			session.flush();
			session.getTransaction().commit();
			session.close();
		}

		public void eliminarSolicitudOrdenCompra (SolicitudOrdenCompra soc) {
			Session session = sf.openSession();
			session.beginTransaction();
			session.delete(soc);
			session.flush();
			session.getTransaction().commit();
			session.close();
		}

		public void modificarSolicitudOrdenCompra (SolicitudOrdenCompra soc) {
			Session session = sf.openSession();
			session.beginTransaction();
			session.update(soc);
			session.flush();
			session.getTransaction().commit();
			session.close();
			
		}
		
		public SolicitudOrdenCompra consultarSolicitudOrdenCompra (int idSolicitudOrdenCompra ) {
			return null;
		}
		
		
	
}
